package com.busi.validate;

import java.util.HashMap;
import java.util.Map;

import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;

/**
 * ******************  类说明  *********************
 * class       :  MerinfValidator
 * @author     :  hejinyun@umpay.com
 * @version    :  1.0  
 * description :  仅能支持当前页面跳转时刷新，弹框性质的刷新不了
 * @see        :                        
 * ***********************************************
 */
public class MerinfValidator extends Validator {

	@Override
	protected void validate(Controller c) {
		validateRequiredString("model.merid", "meridMsg", "商户编码不能为空！");
		validateEmail("model.email", "emailMsg", "邮箱格式有误，请重新输入！");

	}

	@Override
	protected void handleError(Controller c) {
		//c.keepPara();
		c.keepPara();
		Map<String, String> ret = new HashMap<String, String>();
		ret.put("meridMsg", "商户编码不能为空");
		ret.put("emailMsg", "邮箱格式有误");
		c.renderJson(ret);
		c.render("add.html");
		
		//c.render("add.html");
	}

}
